Homework Reinforcement Learning

Studente: Riccardo Armando Di Prinzio

Matricola: 261132

Cooking Chef

Introduzione

Classi necessarie alla codifica e funzioni ausiliarie

Creazione griglia del problema

Funzioni ausiliarie

Classe MDP

Classe Model-free

Parte A

Creazione insieme di stati $S$

a1) Provide a concise description of the states of the MDP

a2) How many states are in this MDP? (i.e. what is $|S|$)

Creazione insieme di azioni $A$

b1) Provide a concise description of the actions of the MDP

b2) How many actions are in this MDP? (i.e. what is $|A|$)

Creazione insieme di transizioni $P$

c) What is the dimensionality of the transition function $P$?

$|P| = 6 \times 66 \times 66$

d) Report the transition function $P$ for any state $s$ and action $a$ in a tabular format

$P[\text{left}, S, S']$
$P[\text{right}, S, S']$
$P[\text{up}, S, S']$
$P[\text{down}, S, S']$
$P[\text{take_egg_beater}, S, S']$
$P[\text{cook_eggs}, S, S']$

Creazione insieme di rewards $R$

e) Describe a reward function $R: S \times A \times S$ and a value of $\gamma$ that will lead to an optimal policy

Tentativo di risoluzione mediante Policy Iteration

f) Does $\gamma \in (0, 1)$ affect the optimal policy in this case? Explain why

g) How many possible policies are there? (all policies, not just optimal policies)

h) Specifica di uno scenario Model-free

Preparazione scenario Model-free
Implementazione scenario Model-free
Risoluzione mediante Monte Carlo Online Control
Stampa della policy trovata

i) Is the computed policy deterministic or stochastic?

j) Is there any advantage to having a stochastic policy? Explain

Parte B

Creazione insieme di stati $S$

Creazione insieme di azioni $A$

Creazione insieme di transizioni $P$ con effetti probabilistici

Creazione insieme di rewards $R$

Specifica del parametro $\gamma$

Tentativo di risoluzione mediante Policy Iteration

a) Report the transition function $P$ for any state $s$ and action $a \in A$

$P[\text{left}, S, S']$
$P[\text{right}, S, S']$
$P[\text{up}, S, S']$
$P[\text{down}, S, S']$
$P[\text{take_egg_beater}, S, S']$
$P[\text{cook_eggs}, S, S']$

b) Does the optimal policy change compared to Part A? Justify your answer

c) Will the value of the optimal policy change? Explain how